﻿@model RIS.Models.AddPhoto

@*@using (Html.BeginForm("AddPhoto","Account","post))
{<form id="search" enctype="multipart/form-data" action="http://www.hackathon.vertexarmy.org/search.php" method="post">
    <input type="file" />
    <input type="submit" />
}
*@

    <form id="savePhoto" enctype="multipart/form-data" action="http://www.hackathon.vertexarmy.org/monitor.php" method="post">
        <input type="file" name="file" id="file" />
        <input type="submit" class="orange" value="Save" id="saveme"/>
        <input type="hidden" name="token" value="@((Session["loggeduser"] as RIS.helpers.user).ID)" id="token"/>
    </form>

<script type="text/javascript">
    $('#savePhoto').ajaxForm(function (msg) {

        var stuff = JSON.parse(msg);
        $("#nrPhotos").append("You have " + stuff.length + " images");
        for (var i = 0; i < stuff.length; i++) {
            var id = stuff[i].id;
            var thumb = stuff[i].thumb;
            var elements = stuff[i].elements;
            $("#collections").append("<div style='height:1px;background:#000;clear:both;'></div>"); // de adaugat buton x cu url la monitor cu token si del=1
            for (var img in elements) {
                $("#collections").append("<div class='imgResult'><a href='" + img.image_link + "' title='" + img.titlu + "'><img src='" + img.data + "'/></a><span><b>Titlu:&nbsp;</b>" + img.titlu + " <br/><b>Link:&nbsp;</b>" + img.image_link + "</span></div>");
            }

            $(".sTitle").show();
        }
    });

    $.get("http://www.hackathon.vertexarmy.org/monitor.php?token="+@((Session["loggeduser"] as RIS.helpers.user).ID),
        function (data) {
            console.log(data)
     
      });
</script>

<div class="inner">
    <div id="nrPhotos"></div>
    <div id="collections"></div>
</div>
<div class="clear"></div>